
import Home from '@/pages/Home';
import Search from '@/pages/Search';
import Login from '@/pages/Login';
import Register from '@/pages/Register';
import Detail from '@/pages/Detail'
import AddCartSuccess from '@/pages/AddCartSuccess'
import ShopCart from '@/pages/ShopCart'
import Trade from '@/pages/Trade'
import Pay from '@/pages/Pay'
import PaySuccess from '@/pages/PaySuccess'
import Center from '@/pages/Center'

export default [
    {
        path:'/center',
        component:Center   //  注册路由组件
    },
    {
        path:'/trade',
        component:Trade   //  注册路由组件
    },
    {
        path:'/pay',
        component:Pay   //  注册路由组件
    },
    {
        path:'/paysuccess',
        component:PaySuccess   //  注册路由组件
    },
    {
        path:'/shopcart',
        component:ShopCart   //  注册路由组件
    },
    {
        path:'/addCartSuccess',
        component:AddCartSuccess   //  注册路由组件
    },
    {
        path:'/detail/:skuId',
        component:Detail   //  注册路由组件
    },
    {
        path:'/home',
        component:Home   //  注册路由组件
    },
    {
        path:'/search/:keyword?',
        component:Search,   //  注册路由组件
        name:'search',  // 命名路由

        // 简化路由的三种方式
        // 第一种:布尔值  只能映射params为组件的属性
        // props:true,  //  额外的把params 参数单独映射为组件内的属性
        // // 第二种:对象
        // props:{},   //  映射无关额外的数据为组件的属性
        // 第三种:函数  可以同时把params和query参数都映射为组件内的属性
        // props(route){
        //     return{keyword:route.params.keyword,keyword1:route.query.keyword}
        // }
    },
    {
        path:'/login',
        component:Login,  //  注册路由组件
        meta:{
            isHidden:true
        }
    },
    {
        path:'/register',
        component:Register,   //  注册路由组件
        meta:{
            isHidden:true
        }
    },

    // 重定向路由
    {
        path:'/',
        redirect:'/home'
    },



    {
        path: '/communication',
        component: () => import('@/pages/Communication/Communication'),
        children: [
          {
            path: 'event',
            component: () => import('@/pages/Communication/EventTest/EventTest'),
            meta: {
              isHideFooter: true
            },
          },
          {
            path: 'model',
            component: () => import('@/pages/Communication/ModelTest/ModelTest'),
            meta: {
              isHideFooter: true
            },
          },
          {
            path: 'sync',
            component: () => import('@/pages/Communication/SyncTest/SyncTest'),
            meta: {
              isHideFooter: true
            },
          },
          {
            path: 'attrs-listeners',
            component: () => import('@/pages/Communication/AttrsListenersTest/AttrsListenersTest'),
            meta: {
              isHideFooter: true
            },
          },
          {
            path: 'children-parent',
            component: () => import('@/pages/Communication/ChildrenParentTest/ChildrenParentTest'),
            meta: {
              isHideFooter: true
            },
          },
          {
            path: 'scope-slot',
            component: () => import('@/pages/Communication/ScopeSlotTest/ScopeSlotTest'),
            meta: {
              isHideFooter: true
            },
          }
        ],
    },
]